package com.clear.snapshot;

/**
 * 发起人（Originator）
 */
public class Originator {
    private String state;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    // 创建备忘录
    public Memento saveStateToMemento(){
        return new Memento(state);
    }

    // 恢复状态：回退到某一个历史记录
    public void getStateFromMemento(Memento memento) {
        state = memento.getState();
    }
}
